package com.he.architecture.controller;

import com.he.architecture.common.controller.LogicController;
import com.he.architecture.dao.CustomerOrderDao;
import com.he.architecture.dto.ResponseResult;
import com.he.architecture.entity.CustomerOrder;
import com.he.architecture.service.CustomerOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/customerOrder")
public class CustomerOrderController extends LogicController<CustomerOrderService, CustomerOrderDao, CustomerOrder,Long> {
    public CustomerOrderController(@Autowired CustomerOrderService service){
        super(service);
    }
    @GetMapping("/getCustomerOrderByCustomerIdAndShopId")
    public ResponseResult getCustomerOrderByCustomerId(@RequestParam("cus_id") Long cus_id,@RequestParam("shop_id") Long shop_id){
        CustomerOrder  customerOrder= getService().getCustomerOrderByCustomerId(cus_id,shop_id);
        Map<String,Object> map=new HashMap<>();
        map.put("customerOrder",customerOrder);
        return new ResponseResult(200,map);
    }
}
